using System;
using System.Collections.Generic;
using System.Linq;
using Abs.Core.DAL.EntityFramework;
using Abs.Core.Models;

namespace Abs.Core.DAL.SetUpDatabase
{
    internal partial class AbsInitializer
    {
        private IList<Day> InitializeDays(AbsContext absContext)
        {
            var days = (from DayOfWeek dayOfWeek in Enum.GetValues(typeof (DayOfWeek))
                        select new Day
                               {
                                   DayId = (int) dayOfWeek,
                                   Title = dayOfWeek.ToString()
                               }).ToList();
            days.ForEach(day => absContext.Days.Add(day));
            absContext.SaveChanges();

            return absContext.Days.ToList();
        }//end of private IList<Day> InitializeDays(AbsContext absContext)
    }
}